<template>
	<div class="treatment">
		<el-row>
			<el-col :span="5" :offset="7">诊疗计划</el-col>
			<el-col :span="4">
				<el-button size="mini" round @click="setFree">自选</el-button>
			</el-col>
			<el-col :span="4"  style="text-align:center;">
				<el-button size="mini" round @click="setHelp">辅助</el-button>
			</el-col>
			<el-col :span="4" style="text-align:center;">
				<el-button size="mini" round @click="showCase">确定</el-button>
			</el-col>
			
		</el-row>
		<div class="treatmentContent">
			<el-row v-if="queryTreatList.length">
		<!-- 急危处置 -->
		<el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="320"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.edit1List" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type1')">撤销</el-button></el-col>
							</el-row>
							<el-row>
								<el-col :span="20"><el-input v-model="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
								<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type1')">增加</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
						<el-button size="mini" round @click="openExam('type1')">检查</el-button>
						<el-button size="mini" round @click="openDrug('type1')">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>紧急处置</span>
			</el-popover>
		</el-col>

		<el-checkbox-group v-model="haveCheck.check1List">
			<el-col :offset="1" v-for="(item,index) in category1List" :key="'d1'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit1List" :key="'ed1'+index">
				<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 检验 -->
		<el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.edit2List" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type2')">撤销</el-button></el-col>
							</el-row>
							<el-row>
								<el-col :span="20"><el-input v-model="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
								<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type2')">增加</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
						<el-button size="mini" round @click="openExam('type2')">检查</el-button>
						<el-button size="mini" round @click="openDrug('type2')">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>检验</span>
			</el-popover>
		</el-col>
		<el-checkbox-group v-model="haveCheck.check2List">
			<el-col  :offset="1" v-for="(item,index) in category2List" :key="'d2'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit2List" :key="'ed2'+index">
			<el-checkbox :label="item.disposalContent" class="manual"  checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 特检 -->
		<el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.edit3List" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type3')">撤销</el-button></el-col>
							</el-row>
							<el-row>
								<el-col :span="20"><el-input v-model="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
								<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type3')">增加</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
						<el-button size="mini" round @click="openExam('type3')">检查</el-button>
						<el-button size="mini" round @click="openDrug('type3')">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>特检</span>
			</el-popover>
		</el-col>
		<el-checkbox-group v-model="haveCheck.check3List">
			<el-col  :offset="1" v-for="(item,index) in category3List" :key="'d3'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit3List" :key="'ed3'+index">
			<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 病因治疗 -->
		<el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.edit4List" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type4')">撤销</el-button></el-col>
							</el-row>
							<el-row>
								<el-col :span="20"><el-input v-model="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
								<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type4')">增加</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
						<el-button size="mini" round @click="openExam('type4')">检查</el-button>
						<el-button size="mini" round @click="openDrug('type4')">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>病因治疗</span>
			</el-popover>
		</el-col>
		<el-checkbox-group v-model="haveCheck.check4List">
			<el-col  :offset="1" v-for="(item,index) in category4List" :key="'d4'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit4List" :key="'ed4'+index">
			<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 对症处理 -->
		<el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.edit5List" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type5')">撤销</el-button></el-col>
							</el-row>
							<el-row>
								<el-col :span="20"><el-input v-model="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
								<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type5')">增加</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
						<el-button size="mini" round @click="openExam('type5')">检查</el-button>
						<el-button size="mini" round @click="openDrug('type5')">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>对症治疗</span>
			</el-popover>
		</el-col>
		<el-checkbox-group v-model="haveCheck.check5List">
			<el-col  :offset="1" v-for="(item,index) in category5List" :key="'d5'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit5List" :key="'ed5'+index">
			<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 防、治并发症 -->
		<el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.edit6List" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type6')">撤销</el-button></el-col>
							</el-row>
							<el-row>
								<el-col :span="20"><el-input v-model="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
								<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type6')">增加</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
						<el-button size="mini" round @click="openExam('type6')">检查</el-button>
						<el-button size="mini" round @click="openDrug('type6')">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>防、治并发症</span>
			</el-popover>
		</el-col>
		<el-checkbox-group v-model="haveCheck.check6List">
			<el-col  :offset="1" v-for="(item,index) in category6List" :key="'d6'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit6List" :key="'ed6'+index">
				<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 中医中药治疗 -->
		<el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.edit7List" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type7')">撤销</el-button></el-col>
							</el-row>
							<el-row>
								<el-col :span="20"><el-input v-model="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
								<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type7')">增加</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
						<el-button size="mini" round @click="openExam('type7')">检查</el-button>
						<el-button size="mini" round @click="openDrug('type7')">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>中医中药治疗</span>
			</el-popover>
		</el-col>
		<el-checkbox-group v-model="haveCheck.check7List">
			<el-col  :offset="1" v-for="(item,index) in category7List" :key="'d7'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit7List" :key="'ed7'+index">
				<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 最后处置 -->
		<!-- <el-col style="border-bottom:1px solid #eeeeee;">
			<el-popover
					placement="right"
					width="200"
					trigger="click">
					<slot>
						<el-button size="mini" round>编辑</el-button>
					<el-button size="mini" round @click="openExam">检查</el-button>
					<el-button size="mini" round @click="openDrug">开药</el-button>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>最后处置</span>
			</el-popover>
		</el-col> -->
		<el-checkbox-group v-model="haveCheck.check8List">
			<el-col  :offset="1" v-for="(item,index) in category8List" :key="'d8'+index">
				<el-checkbox :label="item.disposalCode">
					<el-popover v-if="item.disposalTips"
  						placement="right"
  						title="操作技能说明"
  						width="400"
  						trigger="hover">
  						<slot>
  							<div v-html="item.disposalTips"></div>
  						</slot>
  						<span slot="reference" v-html="item.disposalContent"></span>
					</el-popover>
					<span v-if="!item.disposalTips" v-html="item.disposalContent"></span>
				</el-checkbox>
			</el-col>
		</el-checkbox-group>
		<el-col :offset="1" v-for="(item,index) in editList.edit8List" :key="'ed8'+index">
				<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>
	</el-row>
	<el-row>
		<!-- 单独开检查 -->
		<el-col style="border-bottom:1px solid #eeeeee;" v-if="editList.editExamList.length">
			<el-popover
					placement="right"
					width="60"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">已开检查</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.editExamList" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'typeExam')">撤销</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>检查</span>
			</el-popover>
		</el-col>
		<el-col :offset="1" v-for="(item,index) in editList.editExamList" :key="'edExam'+index">
			<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

		<!-- 单独取药 -->
		<el-col style="border-bottom:1px solid #eeeeee;" v-if="editList.editDrugList.length">
			<el-popover
					placement="right"
					width="60"
					trigger="click">
					<slot>
						<el-popover
						placement="right"
						width="300"
						trigger="click">
							<el-row>
								<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">已开药品</el-col>
							</el-row>
							<el-row v-for="(item,key) in editList.editDrugList" :key="key">
							<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
							<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'typeDrug')">撤销</el-button></el-col>
							</el-row>
							<el-button size="mini" round slot="reference">编辑</el-button>
						</el-popover>
					</slot>
					<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>取药</span>
			</el-popover>
		</el-col>
		<el-col :offset="1" v-for="(item,index) in editList.editDrugList" :key="'edDrug'+index">
			<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
		</el-col>

	</el-row>
		<!-- 病例预览弹窗开始 -->
	<el-dialog
		:visible.sync="caseDialogVisible"
		width="1000px">
		<el-row style="border:1px solid #000000;padding:10px 10px 50px 10px;line-height:45px;font-size:12pt;">
			<el-col :span="24" style="text-align:center;"><h2>病历</h2></el-col>
			<el-col :span="5">
				<label>ID号：</label><span>{{baseInfoData.patientID}}</span>
			</el-col>
			<el-col :span="5">
				<label>姓名：</label><span>{{baseInfoData.patientName}}</span>
			</el-col>
			<el-col :span="4">
				<label>性别：</label><span>{{baseInfoData.sex}}</span>
			</el-col>
			<el-col :span="4">
				<label>年龄：</label><span>{{baseInfoData.age}}</span>
				<span v-if="baseInfoData.ageType=='1岁内婴儿'">个月</span>
				<span v-if="baseInfoData.ageType!='1岁内婴儿'">岁</span>
			</el-col>
			<el-col :span="24">
				<label>过敏史：</label>
				<span v-if="vitalSignData.allergy=='无药物过敏史'">{{vitalSignData.allergy}}</span>
				<span v-if="vitalSignData.allergy!='无药物过敏史'&&vitalSignData.allergy!=''">{{vitalSignData.allergy}}&nbsp;过敏</span>
			</el-col>
			<el-col :span="24">
				<hr style="border-bottom:3px double #000000;">
			</el-col>
			<el-col :span="5">
				<label>体温：</label><span>{{vitalSignData.temperature}}&#8451;</span>
			</el-col>
			<el-col :span="5">
				<label>脉搏：</label><span>{{vitalSignData.pulse}}次/分</span>
			</el-col>
			<el-col :span="5">
				<label>呼吸：</label><span>{{vitalSignData.breath}}次/分</span>
			</el-col>
			<el-col :span="5">
				<label>血压：</label><span>{{vitalSignData.sbp+'/'+vitalSignData.dbp}}mmHg</span>
			</el-col>
			<el-col>
				<label>主诉：</label>
				<span v-if="queryTreatList.length">{{symptomPanelData.complaint.complaintName}}&#12288;{{vitalSignData.diseaseTime+vitalSignData.timeUnit}}</span>
				<span v-if="editList.editDrugList.length">开药</span>
				<span v-if="editList.editExamList.length">开检查</span>
			</el-col>
			<el-col v-if="queryTreatList.length">
				<label>病史体征：</label>
				<span>{{symptomContent}}</span>
				<span v-for="(item,index) in symptomPanelData.editSymptomList" :key="index">{{item.symptomName}}；</span>
			</el-col>
			<el-col v-if="queryTreatList.length">
				<label>一般情况【{{general[lightRank]}}】：</label>
				<span>发育：{{vitalSignData.growth}}</span>&#12288;
				<span>营养：{{vitalSignData.nutrition}}</span>&#12288;
				<span>面容：{{vitalSignData.expression}}</span>&#12288;
				<span>神志：{{vitalSignData.scene}}</span>&#12288;
				<span v-if="baseInfoData.ageType=='成人'">体位：{{vitalSignData.position}}</span>
			</el-col>
			<el-col v-if="queryTreatList.length">
				<label>诊断：</label>
				<span v-for="(item,index) in firstVisitData.diseases" :key="index">{{item.diseaseName}}&#12288;&#12288;</span>
			</el-col>
			<el-col style="line-height:30px;">
				<el-row>
				<el-col><label>处置：</label></el-col>
				<el-col :offset="1" v-for="(item,index) in checkTreatList" :key="index">{{item.disposalAdvice?item.disposalAdvice+"；":""}}</el-col>
				</el-row>
			</el-col>
			<el-col :span="24" style="text-align:right;">
				<label>诊治医生：</label>&#12288;&#12288;&#12288;&#12288;&#12288;&#12288;&#12288;&#12288;
			</el-col>
			<el-col :span="24" style="text-align:right;">
				<label>日期：&#12288;&#12288;&#12288;年&#12288;&#12288;月&#12288;&#12288;日</label>
			</el-col>
		</el-row>
		<span slot="footer" class="dialog-footer">
			<el-button @click="caseDialogVisible = false">打印</el-button>
			<el-button type="primary" @click="caseDialogVisible = false">关闭</el-button>
		</span>
	</el-dialog>
	<!-- 病例预览弹窗结束 -->
	<!-- 开检查弹窗开始 -->
	<el-dialog
		:visible.sync="examDialog"
		:close-on-click-modal="false"
		width="1000px">
		<el-row>
			<!-- 检查检验 -->
			<el-col style="border:1px solid #cccccc;">
				<el-row>
					<!-- <el-col :offset="8">检查/检验</el-col> -->
					<el-col :span="10" style="height:500px;overflow:auto;">
						<el-menu>
					      <el-menu-item :index="'exam_'+index" v-for="(item,index) in examCategoryList" :key="index" @click="getExams(item)">
					        <span :title="item.examCategoryName">{{item.examCategoryName}}</span><span style="color:orange;" v-if="item.examCategorySelected">【{{item.examCategorySelected}}】</span>
					      </el-menu-item>
					    </el-menu> 
					</el-col>
					<el-col :span="14" style="height:500px;overflow:auto;padding-left:10px;">
						<el-checkbox-group v-model="checkExamList">
						    <el-row>
						    	<el-col v-for="(item,index) in examList" :key="index">
						    		<el-checkbox :label="item.examName" :title="item.examName"></el-checkbox>
						    	</el-col>
						    </el-row>
						 </el-checkbox-group>
					</el-col>
				</el-row>
			</el-col>
		</el-row>
		<span slot="footer" class="dialog-footer">
			<el-button @click="examDialog = false">取消</el-button>
			<el-button type="primary" @click="confirmExam">确定</el-button>
		</span>
	</el-dialog>
	<!-- 开检查弹窗结束 -->
	<!-- 开药弹窗开始 -->
	<el-dialog
		:visible.sync="drugDialog"
		:close-on-click-modal="false"
		width="1200px">
		<el-row>
			<el-col style="border:1px solid #cccccc;">
				<el-row>
					<el-col style="height:500px;overflow:auto;">
						<el-row>
							<el-col>
								<el-table
									:data="addDrugList"		    
								    stripe
									border
								    style="width: 100%">
								    <el-table-column label="药品名称" header-align="center">
								      <template slot-scope="scope">
								        <span >{{scope.row.drugName}}</span>
								      </template>
								    </el-table-column>
								    <el-table-column
								      label="药品规格" header-align="center">
								      <template slot-scope="scope">
								      	<span>{{scope.row.drugSpec}}</span>
								      </template>
								    </el-table-column>
								    <el-table-column label="药品类型" header-align="center" width="100">
								      <template slot-scope="scope">
								      	<span>{{scope.row.drugType}}</span>
								      </template>
								    </el-table-column>
								    <el-table-column
								      label="数量" header-align="center" width="200">
								      <template slot-scope="scope">
								      	<el-input-number v-model="scope.row.drugMeasure" :min="1" label="药品数量"></el-input-number>
								      </template>
								    </el-table-column>
								    <el-table-column
								      label="操作" header-align="center" width="80">
								      <template slot-scope="scope">
								      	<el-button
								          size="mini"
								          type="danger"
								          @click="removeDrug(scope.$index, scope.row)">撤销</el-button>
								      </template>
								    </el-table-column>
								 </el-table>
							</el-col>
							<el-col :span="20" :offset="2" style="margin-top:10px;margin-bottom:20px;">
								<label>药品关键字：</label><el-autocomplete class="searchInput"
								  v-model="keyWords"
								  :fetch-suggestions="querySearchAsync"
								  placeholder="请输入内容"
								  @select="confirmSelect">
								</el-autocomplete>
							</el-col>
						</el-row>
					</el-col>
				</el-row>
			</el-col>
			<!-- 开药 -->
		</el-row>
		<span slot="footer" class="dialog-footer">
			<el-button @click="drugDialog = false">取消</el-button>
			<el-button type="primary" @click="confirmDrug">确定</el-button>
		</span>
	</el-dialog>
	<!-- 开药弹窗结束 -->
		</div>
	</div>
</template>
<script type="text/javascript">
	export default{
		name:"Treatment",
		data(){
		return {
			newTreat:'',
			consult:false,
			symptomContent:'',
			editTreatList: [],
			queryTreatList: [],
			checkTreatList: [],
			// checkDisposals: [],
			general:['良好','较好','较差','极差'],
			caseDialogVisible: false,
			examDialog: false,
			drugDialog: false,
			checkExamList:[],
			examList:[],
			examCategoryList:[],
			curCategory:{},
			addDrugList:[],
			keyWords:'',
			category1List:[],
			category2List:[],
			category3List:[],
			category4List:[],
			category5List:[],
			category6List:[],
			category7List:[],
			category8List:[],
			editList: {
				edit1List:[],
				edit2List:[],
				edit3List:[],
				edit4List:[],
				edit5List:[],
				edit6List:[],
				edit7List:[],
				edit8List:[],
				editDrugList:[],
				editExamList:[]
			},
			haveCheck: {
				check1List:[],
				check2List:[],
				check3List:[],
				check4List:[],
				check5List:[],
				check6List:[],
				check7List:[],
				check8List:[]
			},
			examType: '',
			drugType: ''
		}
	},
	computed:{
		disposal(){
			return this.$store.state.disposal;
		},
		kaiExam(){
			return this.$store.state.kaiExam;
		},
		kaiDrug(){
			return this.$store.state.kaiDrug;
		},
		baseInfoData(){
			return this.$store.state.baseInfoData;
		},
		vitalSignData(){
			return this.$store.state.vitalSignData;
		},
		symptomPanelData(){
			return this.$store.state.symptomPanelData;
		},
		firstVisitData(){
			return this.$store.state.firstVisitData;
		},
		lightRank(){
			return this.$store.state.lightRank;
		},
		complaintCode(){
			return this.$store.state.complaintCode;
		},
		saveFlag(){
			return this.$store.state.saveFlag;
		},
		curUser(){
			return this.$store.state.curUser;
		},
		recordData(){
			return this.$store.state.recordData;
		},
		reDisposal(){
			return this.$store.state.reDisposal;
		}
	},
	methods:{
		setFree:function(){
			this.consult = false;
		},
		setHelp:function(){
			this.consult = true;
		},
		addTreat:function(type){
			if (this.newTreat != '') {
				if (type=='type1') {
					this.editList.edit1List.push({
						disposalContent:'@1@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='type2') {
					this.editList.edit2List.push({
						disposalContent:'@2@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='type3') {
					this.editList.edit3List.push({
						disposalContent:'@3@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='type4') {
					this.editList.edit4List.push({
						disposalContent:'@4@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='type5') {
					this.editList.edit5List.push({
						disposalContent:'@5@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='type6') {
					this.editList.edit6List.push({
						disposalContent:'@6@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='type7') {
					this.editList.edit7List.push({
						disposalContent:'@7@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='type8') {
					this.editList.edit8List.push({
						disposalContent:'@8@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='typeExam') {
					this.editList.editExamList.push({
						disposalContent:'@exam@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}else if (type=='typeDrug') {
					this.editList.edit8List.push({
						disposalContent:'@drug@'+this.newTreat,
						disposalAdvice:this.newTreat
					});
				}
			}
			this.newTreat = '';
		},
		removeTreat:function(index,type){
			if (type=='type1') {
				this.editList.edit1List.splice(index,1);
			}else if (type=='type2') {
				this.editList.edit2List.splice(index,1);
			}else if (type=='type3') {
				this.editList.edit3List.splice(index,1);
			}else if (type=='type4') {
				this.editList.edit4List.splice(index,1);
			}else if (type=='type5') {
				this.editList.edit5List.splice(index,1);
			}else if (type=='type6') {
				this.editList.edit6List.splice(index,1);
			}else if (type=='type7') {
				this.editList.edit7List.splice(index,1);
			}else if (type=='type8') {
				this.editList.edit8List.splice(index,1);
			}else if (type=='typeExam') {
				this.editList.editExamList.splice(index,1);
			}else if (type=='typeDrug') {
				this.editList.editDrugList.splice(index,1);
			}
		},
		showCase:function(){
			//处理病史体征中重复描述
			var checkSymptoms = '';
			if (this.symptomPanelData!=null && this.symptomPanelData.checkSymptomList!=null) {
				this.symptomPanelData.checkSymptomList.forEach(function(symptom){
					checkSymptoms = checkSymptoms+symptom.symptomName+'；'
				});
			}
			checkSymptoms = checkSymptoms;
			this.symptomContent = checkSymptoms;

			this.caseDialogVisible = true;
		},
		openExam:function(type){
			this.examType = type;
			this.examCategoryList = [];
			this.examList = [];
			this.checkExamList = [];
			//执行加载examCategory
			var vm = this;
			$.ajax({
					type:"get",
					url:CONST.url+"getExamCategory",
					success:function(result){
						if (result.code==0||result.code=='0') {
							vm.examCategoryList = result.data;
						}else{
							alert("主诉数据请求失败！");
						}
					},
					error:function(){
						alert("主诉数据请求失败！");
					}
				});
			//执行清空操作
			this.examDialog = true;
		},
		openDrug:function(type){
			this.drugType = type;
			this.addDrugList = [];
			this.drugDialog = true;
		},
		getExams:function(examCategory){
			this.examList = [];
			this.curCategory = examCategory;
			var vm = this;
			$.ajax({
					type:"get",
					url:CONST.url+"queryExams",
					data:{
						"examCategoryName": examCategory.examCategoryName,
					},
					success:function(result){
						if (result.code==0||result.code=='0') {
							vm.examList = result.data;
						}else{
							alert("主诉数据请求失败！");
						}
					},
					error:function(){
						alert("主诉数据请求失败！");
					}
				});
		},
		confirmExam:function(){
			var vm =this;
			if (vm.examType == 'type1') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit1List.push({
						disposalContent:'@1@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'type2') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit2List.push({
						disposalContent:'@2@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'type3') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit3List.push({
						disposalContent:'@3@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'type4') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit4List.push({
						disposalContent:'@4@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'type5') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit5List.push({
						disposalContent:'@5@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'type6') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit6List.push({
						disposalContent:'@6@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'type7') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit7List.push({
						disposalContent:'@7@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'type8') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.edit8List.push({
						disposalContent:'@8@'+exam,
						disposalAdvice:exam
					});
				});
			}else if (vm.examType == 'typeExam') {
				vm.checkExamList.forEach(function(exam){
					vm.editList.editExamList.push({
						disposalContent:'@exam@'+exam,
						disposalAdvice:exam
					});
				});
			}
			vm.examDialog = false;
		},
		confirmDrug:function(){
			var vm =this;
			if (vm.drugType == 'type1') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit1List.push({
						disposalContent:'@1@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'type2') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit2List.push({
						disposalContent:'@2@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'type3') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit3List.push({
						disposalContent:'@3@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'type4') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit4List.push({
						disposalContent:'@4@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'type5') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit5List.push({
						disposalContent:'@5@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'type6') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit6List.push({
						disposalContent:'@6@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'type7') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit7List.push({
						disposalContent:'@7@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'type8') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.edit8List.push({
						disposalContent:'@8@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}else if (vm.drugType == 'typeDrug') {
				vm.addDrugList.forEach(function(drug){
					vm.editList.editDrugList.push({
						disposalContent:'@drug@'+drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')',
						disposalAdvice:drug.drugName+':'+drug.drugMeasure+'*('+drug.drugSpec+')'
					});
				});
			}
			vm.drugDialog = false;
		},
		confirmSelect:function(item){
			this.addDrugList.push(item);
			this.keyWords="";
		},
		querySearchAsync:function(queryString, cb){
			var vm =this;
			$.ajax({
					type:"get",
					url:CONST.url+"findDrug",
					data:{
						"keyWords": queryString,
					},
					success:function(result){
						if (result.code==0||result.code=='0') {
							cb(result.data);
						}else{
							alert("主诉数据请求失败！");
						}
					},
					error:function(){
						alert("主诉数据请求失败！");
					}
				})
		},
		removeDrug:function(index,drug){
			console.log(drug)
			this.addDrugList.splice(index,1);
		},
		getFinalDisposal:function(){
			//把处置加入，把新增加入
				var vm =this;
				vm.checkTreatList = [];
				var check1Conent = '-'+vm.haveCheck.check1List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check1Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit1List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});

				var check2Conent = '-'+vm.haveCheck.check2List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check2Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit2List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});

				var check3Conent = '-'+vm.haveCheck.check3List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check3Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit3List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});

				var check4Conent = '-'+vm.haveCheck.check4List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check4Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit4List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});

				var check5Conent = '-'+vm.haveCheck.check5List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check5Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit5List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});

				var check6Conent = '-'+vm.haveCheck.check6List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check6Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit6List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});

				var check7Conent = '-'+vm.haveCheck.check7List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check7Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit7List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});

				var check8Conent = '-'+vm.haveCheck.check8List.join('-')+'-';
				vm.queryTreatList.forEach(function(treat){
						if (check8Conent.indexOf('-'+treat.disposalCode+'-')>=0) {
							vm.checkTreatList.push(treat);
						}
					});
				vm.editList.edit8List.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});
				vm.editList.editExamList.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});
				vm.editList.editDrugList.forEach(function(treat){
						vm.checkTreatList.push(treat);
					});
		}
	},
	watch:{
		disposal:{
			handler(curVal,oldVal){
				if (curVal.timeStamp != oldVal.timeStamp) {
					console.log("待调取处置疾病："+curVal.diseaseCodes);
					var vm = this;
					vm.queryTreatList = [];
					if (curVal.diseaseCodes=='none'||curVal.diseaseCodes=='') {
						return;
					}
					//处理发热情况
					var temperatureDisease = '';
					if (this.vitalSignData.temperature < 36 && this.vitalSignData.temperature > 0) {
						temperatureDisease ='t1'
					}else if (this.vitalSignData.temperature >= 37.3 && this.vitalSignData.temperature <= 38) {
						temperatureDisease ='t2'
					}else if (this.vitalSignData.temperature >= 38.1 && this.vitalSignData.temperature < 39 && this.baseInfoData.age <15) {
						temperatureDisease ='t5'
					}else if (this.vitalSignData.temperature >= 39 && this.vitalSignData.temperature < 41 && this.baseInfoData.age <15) {
						temperatureDisease ='t9'
					}else if (this.vitalSignData.temperature >= 38.1 && this.vitalSignData.temperature < 39 && this.baseInfoData.age >=14 && this.baseInfoData.age <60) {
						temperatureDisease ='t3'
					}else if (this.vitalSignData.temperature >= 39 && this.vitalSignData.temperature < 41 && this.baseInfoData.age >=14 && this.baseInfoData.age <60) {
						temperatureDisease ='t10'
					}else if (this.vitalSignData.temperature >= 38.1 && this.vitalSignData.temperature < 39 && this.baseInfoData.age >59) {
						temperatureDisease ='t4'
					}else if (this.vitalSignData.temperature >= 39 && this.vitalSignData.temperature < 41 && this.baseInfoData.age >59) {
						temperatureDisease ='t11'
					}else if (this.vitalSignData.temperature >= 41 && this.baseInfoData.age <15) {
						temperatureDisease ='t8'
					}else if (this.vitalSignData.temperature >= 41 && this.baseInfoData.age >=14 && this.baseInfoData.age <60) {
						temperatureDisease ='t6'
					}else if (this.vitalSignData.temperature >= 41 && this.baseInfoData.age >59) {
						temperatureDisease ='t7'
					}
				$.ajax({
                    type:"get",
                    url:CONST.url+"queryTreatList",
                    data:{
                    	"diseaseCodes": curVal.diseaseCodes,
                    	"temperatureDisease": temperatureDisease,
                    	"lightRank": parseInt(vm.lightRank)+1
                    },
                    success:function(result){
                        if (result.code==0||result.code=='0') {
                        	//一旦进行智能诊断，就要清空开药开检查
                        	vm.editList.editExamList = [];
                        	vm.editList.editDrugList = [];
                        	vm.consult = false;
                        	vm.queryTreatList = result.data; 
                        	if (vm.queryTreatList == null || vm.queryTreatList.length == 0) {
                        		vm.queryTreatList = [{disposalContent:"抱歉，暂无处置数据"}];
                        	}
                        	vm.haveCheck= {
								check1List:[],
								check2List:[],
								check3List:[],
								check4List:[],
								check5List:[],
								check6List:[],
								check7List:[],
								check8List:[]
							};
                        	//将处置划分类别显示
                        	vm.category1List = [];
                        	vm.category2List = [];
                        	vm.category3List = [];
                        	vm.category4List = [];
                        	vm.category5List = [];
                        	vm.category6List = [];
                        	vm.category7List = [];
                        	vm.category8List = [];
                        	var level = 0;
                        	vm.queryTreatList.forEach(function(disposal){
                        		if (disposal.disposalType == "1") {
                        			level = level + 1;
                        		}
                        		if (level==1 && disposal.disposalType != "1") {
                        			vm.category1List.push(disposal);
                        		}
                        		if (level==2 && disposal.disposalType != "1") {
                        			vm.category2List.push(disposal);
                        		}
                        		if (level==3 && disposal.disposalType != "1") {
                        			vm.category3List.push(disposal);
                        		}
                        		if (level==4 && disposal.disposalType != "1") {
                        			vm.category4List.push(disposal);
                        		}
                        		if (level==5 && disposal.disposalType != "1") {
                        			vm.category5List.push(disposal);
                        		}
                        		if (level==6 && disposal.disposalType != "1") {
                        			vm.category6List.push(disposal);
                        		}
                        		if (level==7 && disposal.disposalType != "1") {
                        			vm.category7List.push(disposal);
                        		}
                        		if (level==8 && disposal.disposalType != "1") {
                        			vm.category8List.push(disposal);
                        		}
                        	});
                        	if (vm.reDisposal=="DSSEND"&&vm.recordData&&vm.recordData.recordDisposal) {
                         			var disposals = vm.recordData.recordDisposal.split("###");
									disposals.forEach(function(disposal){
										//如果是增加的处置
										if (disposal.indexOf('@')==0) {
											var type = disposal.split('@')[1];
											if (type=='1') {
												vm.editList.edit1List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='2') {
												vm.editList.edit2List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='3') {
												vm.editList.edit3List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='4') {
												vm.editList.edit4List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='5') {
												vm.editList.edit5List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='6') {
												vm.editList.edit6List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='7') {
												vm.editList.edit7List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='8') {
												vm.editList.edit8List.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='exam') {
												vm.editList.editExamList.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}else if (type=='drug') {
												vm.editList.editDrugList.push({
													disposalContent:disposal,
													disposalAdvice:disposal.split('@')[2]
												});
											}
										}else{
											//系统中的处置
											vm.category1List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check1List.push(item.disposalCode);
												}
											});

											vm.category2List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check2List.push(item.disposalCode);
												}
											});

											vm.category3List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check3List.push(item.disposalCode);
												}
											});

											vm.category4List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check4List.push(item.disposalCode);
												}
											});

											vm.category5List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check5List.push(item.disposalCode);
												}
											});

											vm.category6List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check6List.push(item.disposalCode);
												}
											});

											vm.category7List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check7List.push(item.disposalCode);
												}
											});

											vm.category8List.forEach(function(item){
												if (item.disposalContent == disposal) {
													vm.haveCheck.check8List.push(item.disposalCode);
												}
											});
										}
									});
                        			vm.$store.commit({
										type: "setReDisposal",
										reDisposal: "DSDONE"
									});
                        		}  	
                        }else{
                        	alert("处置数据请求失败！");
                        }
                    },
                    error:function(){
                    	alert("处置数据请求失败！");
                    }
                })
				}
			}
		},
		complaintCode:{
			handler(curVal,oldVal){
				//清空处置
				this.queryTreatList = [];
				this.checkTreatList = [];
				this.editList.edit1List = [];
				this.editList.edit2List = [];
				this.editList.edit3List = [];
				this.editList.edit4List = [];
				this.editList.edit5List = [];
				this.editList.edit6List = [];
				this.editList.edit7List = [];
				this.editList.edit8List = [];
			}
		},
		symptomPanelData:{
			handler(curVal,oldVal){
				this.queryTreatList = [];
				this.checkTreatList = [];
				this.editList.edit1List = [];
				this.editList.edit2List = [];
				this.editList.edit3List = [];
				this.editList.edit4List = [];
				this.editList.edit5List = [];
				this.editList.edit6List = [];
				this.editList.edit7List = [];
				this.editList.edit8List = [];
			},
			deep:true
		},
		consult:{
			handler(curVal,oldVal){
				var vm =this;
				if (curVal) {
					vm.haveCheck= {
						check1List:[],
						check2List:[],
						check3List:[],
						check4List:[],
						check5List:[],
						check6List:[],
						check7List:[],
						check8List:[]
					}
					vm.category1List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check1List.push(disposal.disposalCode);
						}
					});
					vm.category2List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check2List.push(disposal.disposalCode);
						}
					});
					vm.category3List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check3List.push(disposal.disposalCode);
						}
					});
					vm.category4List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check4List.push(disposal.disposalCode);
						}
					});
					vm.category5List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check5List.push(disposal.disposalCode);
						}
					});
					vm.category6List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check6List.push(disposal.disposalCode);
						}
					});
					vm.category7List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check7List.push(disposal.disposalCode);
						}
					});
					vm.category8List.forEach(function(disposal){
						if (disposal.isNecessity=="1") {
							vm.haveCheck.check8List.push(disposal.disposalCode);
						}
					});

				}else{
					vm.haveCheck= {
						check1List:[],
						check2List:[],
						check3List:[],
						check4List:[],
						check5List:[],
						check6List:[],
						check7List:[],
						check8List:[]
					}
				}
			}
		},
		saveFlag:{
			handler(curVal,oldVal){
				if (!curVal.flag) {
					var vm =this;
					var record = {};
					//处理发病时间
					var diseaseTime = 0;
					if (vm.vitalSignData.timeUnit!=''&&vm.vitalSignData.diseaseTime!='') {
						if (vm.vitalSignData.timeUnit == "分钟") {
							diseaseTime = vm.vitalSignData.diseaseTime;
						}else if(vm.vitalSignData.timeUnit == "小时") {
							diseaseTime = vm.vitalSignData.diseaseTime*60;
						}else if(vm.vitalSignData.timeUnit == "天") {
							diseaseTime = vm.vitalSignData.diseaseTime*1440;
						}else if(vm.vitalSignData.timeUnit == "月") {
							diseaseTime = vm.vitalSignData.diseaseTime*43200;
						}else if(vm.vitalSignData.timeUnit == "年") {
							diseaseTime = vm.vitalSignData.diseaseTime*518400;
						}
					}
					//处理病史体征
					var symptoms ="";
					if (vm.symptomPanelData.checkSymptomList!=null) {
						vm.symptomPanelData.checkSymptomList.forEach(function(symptom){
							symptoms = symptoms + symptom.symptomName+"###";
						});
					}
					symptoms = symptoms +"@@@";
					if (vm.symptomPanelData.editSymptomList!=null) {
						vm.symptomPanelData.editSymptomList.forEach(function(symptom){
							symptoms = symptoms + symptom.symptomName+"###";
						});
					}
					//处理诊断
					var diseases = "";
					if (vm.firstVisitData.diseases!=[]) {
						vm.firstVisitData.diseases.forEach(function(disease){
							diseases = diseases + disease.diseaseName + "###";
						});
					}
					console.log("处理后:"+diseases);
					//处理处置
					var disposals = "";
					if (vm.checkTreatList!=null) {
						vm.checkTreatList.forEach(function(disposal){
							disposals = disposals + disposal.disposalContent+"###";
						});
					}
					record = {
						"recordDoctor":vm.curUser.userName+'-'+vm.curUser.userCode,
						"recordStation":vm.curUser.stationName+'-'+vm.curUser.stationCode,
						"recordCard": vm.baseInfoData.patientID,
						"recordName": vm.baseInfoData.patientName,
						"recordSex": vm.baseInfoData.sex,
						"recordType": vm.baseInfoData.ageType,
						"recordAge": vm.baseInfoData.age,
						"recordTel": vm.baseInfoData.telephone,
						"recordAddress": vm.baseInfoData.address,
						"recordLight": vm.lightRank,
						"recordHumanLight":vm.baseInfoData.humanLight, 
						"recordSense": vm.vitalSignData.scene,
						"recordTemperature": vm.vitalSignData.temperature,
						"recordPulse": vm.vitalSignData.pulse,
						"recordBreath": vm.vitalSignData.breath,
						"recordSbp": vm.vitalSignData.sbp,
						"recordDbp": vm.vitalSignData.dbp,
						"recordGrowth": vm.vitalSignData.growth,
						"recordExpression": vm.vitalSignData.expression,
						"recordPosition": vm.vitalSignData.position,
						"recordNutrition": vm.vitalSignData.nutrition,
						"recordDiseaseTime": diseaseTime,
						"recordTreatPlace":vm.vitalSignData.handlePlace,
	                    "recordStart":vm.baseInfoData.startDate,
	                    "recordMainTell": vm.symptomPanelData.complaint.complaintName,
	                    "recordMainCode": vm.symptomPanelData.complaint.complaintCode,
	                    "recordSymptom":symptoms,
	                    "recordDiagnosis":diseases,
	                    "recordDisposal":disposals
					};
					//需要进行的数据非空检查
					if (record.recordCard=='') {
						vm.$notify({
					          title: '就诊卡信息为空',
					          message: '请完善就诊卡号信息',
					          type: 'warning'
					        });
						//需恢复saveFlag的值
						vm.$store.commit({
							type:"setSaveFlag",
							saveFlag: {
									flag:true,
									type:curVal.type
								}
						});
						return;
					}
					//进行归档设置标志位，归档的数据检查放在此处
					if (curVal.type == "SAVE_FILE") {
						record.recordStatus = '1';
					}
					if (vm.recordData&&vm.recordData.recordId) {
						record.recordId = vm.recordData.recordId;
						$.ajax({
		                    type:"post",
		                    url:CONST.url+"updateRecord",
		                    data: record,
		                    success:function(result){
		                        if (result.code==0||result.code=='0') {
		                        	vm.$notify({
		          							title: '成功',
		          							message: '信息保存成功',
		          							type: 'success'
		        						});
		                        	setTimeout('window.location.reload()',800); 	
		                        }else{
		                        	alert("保存失败！");
		                        	vm.$store.commit({
										type:"setSaveFlag",
										saveFlag: {
											flag:true,
											type:curVal.type
										}
									});
		                        }
		                    },
		                    error:function(){
		                    		alert("连接失败！");
		                    		vm.$store.commit({
										type:"setSaveFlag",
										saveFlag: {
											flag:true,
											type:curVal.type
										}
									});
		                    	}
		                	});
					}else{
						$.ajax({
		                    type:"post",
		                    url:CONST.url+"addRecord",
		                    data: record,
		                    success:function(result){
		                        if (result.code==0||result.code=='0') {
		                        	vm.$notify({
		          							title: '成功',
		          							message: '信息保存成功',
		          							type: 'success'
		        						});
		                        	setTimeout('window.location.reload()',800); 	
		                        }else{
		                        	alert("保存失败！");
		                        	vm.$store.commit({
										type:"setSaveFlag",
										saveFlag: {
											flag:true,
											type:curVal.type
										}
									});
		                        }
		                    },
		                    error:function(){
		                    		alert("连接失败！");
		                    		vm.$store.commit({
										type:"setSaveFlag",
										saveFlag: {
											flag:true,
											type:curVal.type
										}
									});
		                    	}
		                	});
					}
				}
			}
		},
		checkExamList:{
			handler(curVal,oldVal){
				var vm = this;

				if (curVal.length>oldVal.length) {
					vm.examCategoryList.forEach(function(category){
						if (vm.curCategory.examCategoryName == category.examCategoryName) {
							category.examCategorySelected = category.examCategorySelected + 1;
						}
					});
				}else{
					vm.examCategoryList.forEach(function(category){
						if (vm.curCategory.examCategoryName == category.examCategoryName) {
							category.examCategorySelected = category.examCategorySelected - 1;
						}
					});
				}
			}
		},
		haveCheck:{
			handler(curVal,oldVal){
				this.getFinalDisposal();
			},
			deep:true
		},
		editList:{
			handler(curVal,oldVal){
				this.getFinalDisposal();
			},
			deep:true
		},
		kaiExam:{
			handler(curVal,oldVal){
				if (this.complaintCode) {
					this.$notify({
					          title: '提示',
					          message: '当前已进入诊断，请使用处置内的增加检查功能',
					          type: 'warning'
					        });
					return;
				}else{
					this.openExam('typeExam');
				}
			},
			deep:true
		},
		kaiDrug:{
			handler(curVal,oldVal){
				if (this.complaintCode) {
					this.$notify({
					          title: '提示',
					          message: '当前已进入诊断，请使用处置内的开药功能',
					          type: 'warning'
					        });
					return;
				}else{
					this.openDrug('typeDrug');
				}
			},
			deep:true
		}
	}
	}
</script>
<style type="text/css" scoped>
.treatment{
	height: 700px;
	border: 1px solid #cccccc;
	background-color: #ffffff;
	text-align: left;
	padding-left: 10px;
	line-height: 30px;
	}
	.treatmentContent{
		overflow: auto;
		height: 668px;
	}
	label{
		font-weight: bolder;
	}
	.disposalCategory{
		font-weight: bolder;
		color: gray;
		font-size: 9pt;
		cursor: pointer;
	}
</style>